#pragma once

#include <algorithm/analytical_model/algorithm/cuda/inter_op/Data.h>

#include <cmath>

namespace solar::cuda
{
    inline __host__ __device__ auto calTMax(float dir, float interval, int current_index,
                                            float current_pos) -> float
    {
        return std::abs(float(current_index + static_cast<int>(dir >= 0)) * interval - current_pos);
    }

    inline __host__ __device__ constexpr auto equal(float n1, float n2) -> bool
    {
        return (n1 < n2 + inter_op::kEpsilon) && (n1 > n2 - inter_op::kEpsilon);
    }

    inline __host__ __device__ constexpr auto less(float n1, float n2) -> bool
    {
        return n1 < n2 - inter_op::kEpsilon;
    }

    inline __host__ __device__ constexpr auto lessEqual(float n1, float n2) -> bool
    {
        return n1 < n2 + inter_op::kEpsilon;
    }
} // namespace solar::cuda
